package com.example.demo.dto;


import java.util.List;
import java.util.Map;

//@Schema(description = "查询结果数据传输对象")
public class QueryResultDTO {

    //@Schema(description = "查询结果的列名列表", example = "[\"id\", \"name\", \"email\"]")
    private List<String> columnNames;

    //@Schema(description = "查询结果的数据行，每行是一个键值对对象")
    private List<Map<String, Object>> rows;

    //@Schema(description = "实际返回的行数", example = "2")
    private Integer totalRows;

    //@Schema(description = "是否还有更多数据", example = "true")
    private Boolean hasMore;

    //@Schema(description = "实际执行的SQL语句", example = "SELECT id, name, email FROM users LIMIT 5")
    private String executedSql;

    //@Schema(description = "查询执行时间（毫秒）", example = "125")
    private Long executionTime;

    // 构造函数
    public QueryResultDTO() {}

    public QueryResultDTO(List<String> columnNames, List<Map<String, Object>> rows, 
                         Integer totalRows, Boolean hasMore, String executedSql, Long executionTime) {
        this.columnNames = columnNames;
        this.rows = rows;
        this.totalRows = totalRows;
        this.hasMore = hasMore;
        this.executedSql = executedSql;
        this.executionTime = executionTime;
    }

    // Getter和Setter方法
    public List<String> getColumnNames() {
        return columnNames;
    }

    public void setColumnNames(List<String> columnNames) {
        this.columnNames = columnNames;
    }

    public List<Map<String, Object>> getRows() {
        return rows;
    }

    public void setRows(List<Map<String, Object>> rows) {
        this.rows = rows;
    }

    public Integer getTotalRows() {
        return totalRows;
    }

    public void setTotalRows(Integer totalRows) {
        this.totalRows = totalRows;
    }

    public Boolean getHasMore() {
        return hasMore;
    }

    public void setHasMore(Boolean hasMore) {
        this.hasMore = hasMore;
    }

    public String getExecutedSql() {
        return executedSql;
    }

    public void setExecutedSql(String executedSql) {
        this.executedSql = executedSql;
    }

    public Long getExecutionTime() {
        return executionTime;
    }

    public void setExecutionTime(Long executionTime) {
        this.executionTime = executionTime;
    }

    @Override
    public String toString() {
        return "QueryResultDTO{" +
                "columnNames=" + columnNames +
                ", rows=" + rows +
                ", totalRows=" + totalRows +
                ", hasMore=" + hasMore +
                ", executedSql='" + executedSql + '\'' +
                ", executionTime=" + executionTime +
                '}';
    }
}